/*
 * Singleton.h
 *
 *  Created on: Mar 19, 2014
 *      Author: GW
 */

#ifndef SINGLETON_H_
#define SINGLETON_H_

template<typename T>
class Singleton
{
protected:
	static T* _instance;

	Singleton(){};
	~Singleton(void){};
	Singleton(T const&);
	void operator = (T const&);

public:
	static T* getInstance()
	{
		if (!_instance)
			_instance = new T();
		return _instance;
	}

	static void deleteInstance()
	{
		if (_instance)
			delete _instance;
		_instance = 0;
	}

	static void resetInstance()
	{
		_instance = new T();
	}

};

template<typename T>
T* Singleton<T>::_instance = 0;
#endif /* SINGLETON_H_ */
